#include <sys/types.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/errno.h>
#include <sys/socket.h>

void main() {
	int sockfd;
	if ((sockfd = socket(9999, SOCK_STREAM, 0)) < 0) {
		perror("socket error");
		printf("errno=%d\n", errno);
		exit(1);
	}
}
/*
>./a.out
socket error: Address family not supported by protocol
errno=97

>grep 'Address family not supported by protocol' /usr/include/asm-generic/errno.h
#define	EAFNOSUPPORT	97	/* Address family not supported by protocol 

>man socket

*/